Conversation
nadavosa
left a comment
There was a problem hiding this comment.
Three issues that need fixing:
1. Missing return + wrong condition in both new components
NewestOpportunities.tsx line 24 and NewestVolunteers.tsx line 22 — the early-exit block never returns anything:
if (opportunities?.length === 0) {
<Heading4>{t("dashboard.home.content.loading")}</Heading4>; // no return!
}Two problems:
- Missing
returnkeyword — the message is never rendered length === 0means data loaded empty, not loading. UseisLoadingfrom the query hook for the loading state, and handle the empty case separately
2. Non-specific React Query keys risk cache collisions
queryKey: ["opportunities"] and queryKey: ["volunteers"] will share the cache with the full list pages if they use the same keys. The dashboard fetches only 2 newest with NEW status — this needs a distinct key, e.g. ["opportunities", "newest"] and ["volunteers", "newest"].
3. DashboardContentContainer height removed in HomeContent.tsx
The previous height: 300px is gone in the new styles.ts. If this is intentional please confirm — if children don't have intrinsic heights the container may collapse.
|
thanks @nadavosa! All very good points and well-spotted. As for point 3, I removed the height because the Newest Volunteers are vertically stacked on top of the New Opportunites, so it exceeds the height of 300px and spills into the Footer (and beyond). I added a |
Description
Adds newest opportunities and volunteers to dashboard home page (2 of each)
Related Issues
Closes #411
Changes
/dashboardpageScreenshots / Demos
Checklist